linux NFS 服务手动挂载nas文件 |
您所在的位置:网站首页 › nas 文件共享 › linux NFS 服务手动挂载nas文件 |
【服务端server】配置:
nas 服务端配置,安装centos系统时候勾选选择NFS 包,NFS相关工具就都安装了, 也可以手动安装 安装nfs工具 nfs-utils:包含NFS服务端守护进程和NFS客户端的工具 rpcbind:提供RPC的端口映射的守护进程及其相关文档、执行文件等 yum -y install nfs-utils rpcbindNFS使用/etc/exports定义需要共享的目录及访问对象的控制,默认无,可以自己创建 vim /etc/exports /app/test/ 192.168.45.0/255.255.255.0(rw,no_root_squash,async)配置说明: 1、/app/test/:这个是本地要共享出去的目录; 2、*:指的是允许的ip地址指的是【客户机client】,*表示所有;可以是一个IP:10.1.1.0,也可以是一个IP段; 3、(rw,sync,no_root_squash): 1)rw表示可读写,ro只读; 2)sync :同步模式,时时写入磁盘;async :不同步,定期写入磁盘; 3)no_root_squash :加上这个选项后,root用户就会对共享的目录拥有至高的权限控制,就像是对本机的目录操作一样。 不安全,不建议使用; root_squash:和上面的选项对应,root用户对共享目录的权限不高,只有普通用户的权限,即限制了root; all_squash:不管使用NFS的用户是谁,他的身份都会被限定成为一个指定的普通用户身份; 4)anonuid/anongid :要和root_squash 以及all_squash一同使用,用于指定使用NFS的用户限定后的uid和gid ,前提是本机的/etc/passwd中存在这个uid和gid。 5)fsid=0表示将/app/eweb整个目录包装成根目录 比如这样配置:/app/test *(rw,sync,no_root_squash,fsid=0) 复杂配置示例:/app/test 192.168.1.8/24(rw,no_root_squash,no_all_squash,sync,anonuid=501,anongid=501) 配置生效 exportfs -arv设置rpcbind、nfs开机启动 systemctl enable rpcbind.service systemctl enable nfs-server.service启动命令 systemctl start rpcbind.servicenfs无需启动 systemctl start nfs.service systemctl start nfs-server.service #rock9检查NFS服务器是否启动 rpcinfo -p查看【服务机server】可挂载目录 showmount -e 192.168.45.132如果报错:clnt_create: RPC: Program not registered 解决方式一: systemctl stop rpcbind.servicesystemctl start rpcbind.service systemctl start nfs-server.service #rock9k #开放端口 firewall-cmd --permanent --add-service=rpc-bind firewall-cmd --permanent --add-service=mountd firewall-cmd --permanent --add-port=2049/tcp firewall-cmd --permanent --add-port=2049/udp firewall-cmd --reload 【客户端client】部署NFS服务在客户端查看可挂载目录 showmount -e 192.168.45.132如果报错:clnt_create: RPC: Program not registered 解决方式一: systemctl stop rpcbind.servicesystemctl start rpcbind.service systemctl start nfs-server.service设置autoshare 自动挂载:/etc/auto.share /app/test/ -fstype=nfs,vers=3,rw 192.168.45.132:/app/test/NFS文件系统挂载与卸载 #挂载格式:mount -t nfs 服务器地址:/共享目录 /本机挂载点 #卸载格式:umount 挂载目标 将【服务器server】共享目录挂载到本地的/app/test目录 mount -t nfs 192.168.45.132:/app/test/ /app/test |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |